package com.project.restaurant.meal.dao;



import com.project.restaurant.meal.dto.MealDetail;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface MealDetailDao {

    @Results(value = {
            @Result(column = "meal_id",property = "mealId"),
            @Result(property = "mealType",
                    one = @One(resultMap = "com.project.restaurant.mapper.MealTypeMapper.MealTypeResultMap")),
            @Result(property = "mealPictures",
                    many = @Many(resultMap = "com.project.restaurant.mapper.MealPictureMapper.MealPictureResultMap")),
    })
    @Select("select m.*,mp.meal_picture_url,mt.meal_type from meal m " +
            "left join r_meal_picture mp on m.meal_id = mp.meal_id " +
            "join r_meal_type mt on m.meal_type_id = mt.meal_type_id")
    public List<MealDetail> selectAll();
}
